/*
 * Copyright (C) 2019 Honeywell, Inc. All Rights Reserved.
 */
package org.thanos.iot.dao.graphic;

import com.honeywell.tj.iot.entity.graphic.GraphicItemPoint;
import com.honeywell.tj.iot.mapper.graphic.dao.GraphicItemProvider;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName PointItemMapper
 * @Author H241118
 * @Date 3/10/2020 2:53 PM
 **/
@Mapper
public interface GraphicItemPointMapper {

    @Select("SELECT point_id AS pointId FROM iot_graphic_item_point WHERE uuid = #{uuid} LIMIT 1")
    Integer selectPointIdByUuid(String uuid);

    @Select("SELECT point_id AS pointId FROM iot_graphic_item_point WHERE uuid = #{uuid}")
    List<Integer> selectPointIdsByUuid(String uuid);

    @InsertProvider(type = GraphicItemProvider.class, method = "dynamicAddPointItems")
    Integer insertPointItem(GraphicItemPoint graphicItemPoint);

    @Delete("DELETE FROM iot_graphic_item_point WHERE uuid = #{uuid}")
    Integer deletePointItemByUuid(String uuid);

    @Delete("DELETE FROM iot_graphic_item_point WHERE point_Id = #{pointId}")
    Integer deletePointItemByPointId(Integer pointId);
}
